//
//  LLAd_cell.m
//  LoveLove
//
//  Created by 吴志强 on 2019/6/23.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "LLAd_cell.h"

@interface LLAd_cell ()

@end

@implementation LLAd_cell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];

    if (self) {

        [self setview];
    }

    return self;
}

- (void) setview
{
//    self.contentView.backgroundColor = [UIColor redColor];

    _contentTextLbl = [LLInitBaseViewTool labelWithText:nil textColor:UIColor.blackColor font:19 textAlignment:NSTextAlignmentLeft];
    _contentTextLbl.frame = CGRectMake(20, 20, [[UIScreen mainScreen] bounds].size.width-40, 40);
    _contentTextLbl.numberOfLines = 3;
    [self.contentView addSubview:_contentTextLbl];

    _img = UIImageView.new;
    _img.frame = CGRectMake(20, _contentTextLbl.bottom+10, [[UIScreen mainScreen] bounds].size.width-40, 180);
    _img.layer.cornerRadius = 2;
    _img.clipsToBounds = YES;
    _img.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:_img];

    UILabel *label = [LLInitBaseViewTool labelWithText:nil textColor:LLColorRGB(131) font:11 textAlignment:NSTextAlignmentLeft];
    label.frame = CGRectMake(20, _img.bottom+10, 40, 20);
    label.text = @"广告";
    label.textColor = [UIColor orangeColor];
    label.layer.borderColor = [UIColor orangeColor].CGColor;
    label.layer.borderWidth = 1;
    label.layer.cornerRadius = 5;
    label.layer.masksToBounds = YES;
    label.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:label];

    _bottomInfoLbl = [LLInitBaseViewTool labelWithText:nil textColor:LLColorRGB(131) font:15 textAlignment:NSTextAlignmentLeft];
    _bottomInfoLbl.frame = CGRectMake(label.right+5, _img.bottom+10, LLScreenWidth-90, 20);
    [self.contentView addSubview:_bottomInfoLbl];

    _editBtn = [LLInitBaseViewTool buttonWithTitle:nil image:@"close_edit" titleColor:nil font:0];
    _editBtn.frame = CGRectMake([[UIScreen mainScreen] bounds].size.width-40, _img.bottom+10, 20, 20);
    [_editBtn addTarget:self action:@selector(editBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_editBtn];
}

- (void) setModel:(LLStatusModel *)model
{
    _model = model;
    if (model.img.length > 0) {
        [_img sd_setImageWithURL:LLImageWithUrl(model.video_img) placeholderImage:[UIImage imageNamed:@"placeholder"] options:SDWebImageRefreshCached];
    }
    _contentTextLbl.text = [NSString stringWithFormat:@"%@",model.title];
    self.bottomInfoLbl.text = [NSString stringWithFormat:@"%@",model.info];
}

- (void) editBtnClick
{

}

@end
